function curry(fn){
    function curried(...args){
        if(args.length >= fn.length){
            return fn(...args)
        }else{
            return function(...args2){
                return curried(...args.concat(args2))
            }
        }
    }
    return curried
}
let add = curry(function(a,b,c){
    return a+b+c
})

console.log(add(1)(2)(3))
